home *** CD-ROM | disk | FTP | other *** search
- //copies model coord to tex coord 1
- //does 1 simple directional light
- //applies vertex diffuse colors and texture sampling
- //Luke Lenhart
- //(C)2004-2005 Digipen Institute of Technology
-
- //directional light
- float4 lgtDirection;
- //float4 lgtDiffuse;
- float4 lgtAmbient;
-
- //tint color
- float4 tint;
-
- //world,view,projection transform
- float4x4 matWorldViewProj;
- float4x4 matWorld;
-
- //shader input
- struct VS_INPUT
- {
- float4 Pos : POSITION;
- float4 Normal : NORMAL;
- float2 Tex0 : TEXCOORD0;
- float4 Clr : COLOR0;
- };
-
- //shader output
- struct VS_OUTPUT
- {
- float4 Pos0 : POSITION;
- float4 Pos1 : TEXCOORD1;
- float2 Tex0 : TEXCOORD0;
- float4 Clr : COLOR0;
- };
-
- //shader code
- VS_OUTPUT VShader(VS_INPUT In)
- {
- VS_OUTPUT Out;
-
- //copy tex coord
- Out.Tex0=In.Tex0;
-
- //calc transformed position
- Out.Pos0=mul(matWorldViewProj,In.Pos);
- Out.Pos1=mul(matWorld,In.Pos);
-
- //calc directional light color
- float3 norm=mul(matWorld,In.Normal.xyz);
- //Out.Clr.xyz=dot(norm,lgtDirection)*lgtDiffuse.xyz + lgtAmbient.xyz;
- Out.Clr.a=1.0f;
- //Out.Clr*=In.Clr;
-
- //tint color
- //Out.Clr*=1-tint;
- Out.Clr.xyz=dot(norm,lgtDirection)*tint.xyz + lgtAmbient.xyz;
-
- //spit out the results
- return Out;
- }
-